package com.travelpass.slidingMenu;

import java.util.ArrayList;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.actionbarsherlock.app.ActionBar;
import com.slidingmenu.lib.SlidingMenu;
import com.travelpass.R;
import com.travelpass.fragments.Horaires;
import com.travelpass.fragments.HorairesCar;
import com.travelpass.fragments.HorairesTrain;
import com.travelpass.fragments.HorairesVol;

@SuppressLint("ValidFragment")
public class MenuList extends Fragment implements OnClickListener {

	SlidingMenu slidingMenu;
	ArrayList<String> menu;
	ActionBar actionBar;
	FragmentManager fragmentManager;

	RelativeLayout horaires, car, train, vol;

	public MenuList() {
		
	}

	public MenuList(SlidingMenu sm, ActionBar ab, FragmentManager fm) {
		slidingMenu = sm;
		actionBar = ab;
		fragmentManager = fm;
	}

	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.list, container, false);
		horaires = (RelativeLayout) view.findViewById(R.id.horaires);
		horaires.setOnClickListener(this);
		car = (RelativeLayout) view.findViewById(R.id.car);
		car.setOnClickListener(this);
		train = (RelativeLayout) view.findViewById(R.id.train);
		train.setOnClickListener(this);
		vol = (RelativeLayout) view.findViewById(R.id.vol);
		vol.setOnClickListener(this);
		return view;

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.horaires:
			getFragmentManager().beginTransaction().replace(R.id.content_frame, new Horaires()).commit();
			slidingMenu.showContent();
		case R.id.car:
			getFragmentManager().beginTransaction().replace(R.id.content_frame, new HorairesCar()).commit();
			slidingMenu.showContent();
			break;
		case R.id.train:
			getFragmentManager().beginTransaction().replace(R.id.content_frame, new HorairesTrain()).commit();
			slidingMenu.showContent();
			break;
		case R.id.vol:
			getFragmentManager().beginTransaction().replace(R.id.content_frame, new HorairesVol()).commit();
			slidingMenu.showContent();
			break;
		}
	}
}
